fix: resolve 11 oracle test failures (180/181)#13
Merged
Conversation
- is_varfd: require first char to be letter/underscore (heredoc_formatting 9) - is_assignment_word: reject subscripts with spaces (word_boundaries 2) - $[...] deprecated arith: track bracket depth (word_boundaries 8) - Trailing \ at EOF: push \\ in word lexer, quotes, expansions, and heredoc body (ansi_c_escapes 3, redirect_formatting 3, heredoc_formatting 1) - Remove unused read_until_char Oracle: 175/181 (was 169). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- is_varfd: require first char to be letter/underscore, rejecting
{6d} which is not a valid bash variable name (heredoc_formatting 9)
- is_assignment_word: reject subscripts containing whitespace, so
arr[0 until ]=$ is not treated as assignment (word_boundaries 2)
- $[...] deprecated arith: new read_deprecated_arith with bracket
depth tracking replaces read_until_char (word_boundaries 8)
- Trailing \ at EOF: push \\ (literal backslash) in word lexer,
double-quoted strings, matched parens, param expansion braces,
and heredoc body (ansi_c_escapes 3, redirect_formatting 3)
- Remove unused read_until_char
6 entries removed from KNOWN_ORACLE_FAILURES.
6 remaining: heredoc_formatting 1 (trailing \n at EOF), ansi_c_escapes
13+18, other 10, heredoc_formatting 8, redirect_formatting 7,
cmdsub_formatting 9.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Coproc redirect: parse_coproc now checks if first token after coproc is a redirect operator (<<, <>, etc.) and parses it as a redirect instead of a word (heredoc_formatting 8, redirect_formatting 7) - Heredoc delimiter: allow trailing whitespace on delimiter line (ansi_c_escapes 18) - Background ordering: insert trailing & before heredoc content on the delimiter line, not after (partial fix for cmdsub_formatting 9) 4 remaining known failures: - heredoc_formatting 1: trailing \n at EOF in heredoc body - ansi_c_escapes 13, other 10: bash-oracle control char doubling - cmdsub_formatting 9: trailing space before ) in cmdsub Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Bash internally prefixes CTLESC (0x01) and CTLNUL (0x7F) bytes with a CTLESC marker in its word representation. When ANSI-C escapes like $'\x1' or $'\01' produce these byte values, the internal string contains two copies of the byte. Match this behavior in process_ansi_c_content for hex and octal escapes: when the escape value equals CTLESC or CTLNUL, prefix the output with an extra 0x01 byte. Fixes ansi_c_escapes 13, other 10. Oracle: 179/181 (2 remaining). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1e24f6f to
a336ea4
Compare
When a heredoc body's last line ends with \ at EOF, bash doesn't append a trailing newline (the backslash consumes the implicit newline). Track whether the backslash-at-EOF handler fired and skip the \n push in that case. Verified against bash-oracle: normal EOF lines get \n, but lines ending with trailing \ at EOF do not. Fixes heredoc_formatting 1. Oracle: 180/181 (1 remaining: cmdsub_formatting 9 — trailing space). Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
a336ea4 to
4af8d91
Compare
mpecan
added a commit
that referenced
this pull request
Mar 25, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.8](rable-v0.1.7...rable-v0.1.8) (2026-03-25) ### Features * enrich AST with structured word spans and assignment detection ([9163d24](9163d24)) * enrich AST with structured word spans and assignment detection ([#11](#11)) ([3b58c38](3b58c38)) ### Bug Fixes * CTLESC byte doubling for bash-oracle compatibility (179/181) ([72bc381](72bc381)) * heredoc trailing newline at EOF with backslash (180/181) ([4af8d91](4af8d91)) * resolve 11 oracle test failures (180/181) ([#13](#13)) ([69d6bc8](69d6bc8)) * resolve 3 more oracle failures (177/181) ([8aca953](8aca953)) * resolve 6 oracle test failures ([0496222](0496222)) * resolve 6 oracle test failures (175/181) ([1708884](1708884)) ### Documentation * comprehensive documentation update ([#14](#14)) ([6abfb20](6abfb20)) * comprehensive documentation update for better DX ([61114b0](61114b0)) ### Code Refactoring * remove sexp re-parsing by threading spans through all nodes ([54db8c7](54db8c7)) * simplify span collection, move to owned tokens, remove dead code ([cec7e8e](cec7e8e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 9 of the 12 remaining oracle test failures, bringing the score from 169/181 to 177/181.
Fixes
is_varfdvalidation{6d}accepted as varfd_arr[0 until ]=$assignment$[...]bracket depth]read_deprecated_arithwith depth\at EOF\instead of\\\\when EOF after\\<</<>aftercoprocas wordsEOFnot matchingEOF&after heredoc contentRemaining 4 known failures
\nat EOF in heredoc body\x1→ 2 bytes)\01→ 2 bytes))in cmdsub with background heredocAlso
read_until_charfunctionTest plan
cargo clippy --all-targets -- -D warningsclean🤖 Generated with Claude Code